import QtQuick 2.14
import QtQuick.Window 2.14
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.14
import QtQuick.Controls.Material 2.12

import QtQuick.Controls 1.4 as TabControl

import "qrc:/_context/Basic"
import "qrc:/_context/CusCheckBox"
import "qrc:/_context/CusInput"
import "qrc:/_context/CusGroupBox"
import "qrc:/_context/Container"
import "qrc:/_context/Modbus"
import "qrc:/_context/CusButton"

/*
    AMS 机舱报警监测系统
*/

Item{

    Column{
        anchors.fill: parent
        anchors.rightMargin: 60
        anchors.topMargin: 25
        anchors.bottomMargin: 50
        anchors.leftMargin: 60
        spacing: 10;


        YaheiText{
            id: title;
            text: "Modbus 客户端设置：";
        }

        Row{
            id: btnMana;
            spacing: 15;

            HldButton{
                width: 160;
                height: 46;
                text: "1# Modbus-Client";

                Layout.preferredHeight: 28
                Layout.preferredWidth: 78
                font.pixelSize:  14;
                font.bold: true;
                backRadius: 4
                bckcolor: "#EC3315"

                onClicked: {
                    tabs.currentTab = 0;
                }
            }

            CusButton{
                width: 160;
                height: 46;
                text: "2# Modbus-Client";
                onClicked: {
                    tabs.currentTab = 1;
                }
            }

            CusButton{
                width: 160;
                height: 46;
                text: "3# Modbus-Client";
                onClicked: {
                    tabs.currentTab = 2;
                }
            }

            CusButton{
                width: 160;
                height: 46;
                text: "4# Modbus-Client";
                onClicked: {
                    tabs.currentTab = 3;

                }
            }


        }

        /*
        Rectangle{
            anchors.top: btnMana.bottom;
            // Layout.fillWidth: true;

            height: 480;
            color: "transparent";

            TabWidget{

                id: tabs;
                // anchors.fill: parent;
                Layout.fillWidth: true;

                // Modbus Client-1#
                Rectangle {
                    property string title: "Modbus Client-1#"
                    anchors.fill: parent;
                    color: "#252528";

                    Rectangle {
                        anchors.fill: parent;
                        anchors.margins: 15;
                        color: "#252528";

                        RowLayout{
                            anchors.fill: parent;
                            spacing: 10;

                            Modbus1{
                                id: modbus_1;
                                text: "Modbus Client-1#：";
                                Layout.fillWidth: true;
                                Layout.fillHeight: true;
                            }

                            CusButton{
                                text: "配置";
                            }
                        }
                    }
                }

                // Modbus Client-2#
                Rectangle {
                    property string title: "Modbus Client-2#"
                    anchors.fill: parent
                    color: "#e3e3e3"

                    Rectangle {
                        anchors.fill: parent;
                        anchors.margins: 15;
                        color: "#252528";

                        Modbus2{
                            id: modbus_2;
                            text: "Modbus Client-2#：";
                            Layout.fillWidth: true;
                            Layout.fillHeight: true;
                        }
                    }
                }

                // Modbus Client-3#
                Rectangle {
                    property string title: "Modbus Client-3#"
                    anchors.fill: parent; color: "#e3e3e3"

                    Rectangle {
                        anchors.fill: parent;
                        anchors.margins: 15;
                        color: "#252528";

                        Modbus3{
                            id: modbus_3;
                            text: "Modbus Client-3#：";
                            Layout.fillWidth: true;
                            Layout.fillHeight: true;
                        }
                    }
                }

                // Modbus Client-4#
                Rectangle {
                    property string title: "Modbus Client-4#"
                    anchors.fill: parent;
                    color: "#e3e3e3";

                    Rectangle {
                        anchors.fill: parent;
                        anchors.margins: 15;
                        color: "#252528";

                        Modbus4{
                            id: modbus_4;
                            text: "Modbus Client-4#：";
                            Layout.fillWidth: true;
                            Layout.fillHeight: true;
                        }
                    }
                }
            }

        }
        */

        Rectangle{
            anchors.top: btnMana.bottom;

            TabControl.TabView {
                id: tabs;
                anchors.fill: parent;

                property int currentTab: 0;
                currentIndex: currentTab;

                TabControl.Tab{
                    Rectangle{
                        anchors.fill: parent;

                        Modbus1{
                            id: modbus_1;
                            text: "Modbus Client-1#：";
                            Layout.fillWidth: true;
                            Layout.fillHeight: true;
                        }
                    }
                }

                TabControl.Tab{
                    Rectangle{
                        anchors.fill: parent;

                        Modbus2{
                            id: modbus_2;
                            text: "Modbus Client-2#：";
                            Layout.fillWidth: true;
                            Layout.fillHeight: true;
                        }
                    }
                }

                TabControl.Tab{
                    Rectangle{
                        anchors.fill: parent;

                        Modbus3{
                            id: modbus_3;
                            text: "Modbus Client-3#：";
                            Layout.fillWidth: true;
                            Layout.fillHeight: true;
                        }
                    }
                }

                TabControl.Tab{
                    Rectangle{
                        anchors.fill: parent;

                        Modbus4{
                            id: modbus_4;
                            text: "Modbus Client-4#：";
                            Layout.fillWidth: true;
                            Layout.fillHeight: true;
                        }
                    }
                }

            }
        }

    }



}
